<!DOCTYPE html>
<?php

require_once ('conn.php');
require_once ('top.php');
if($_SESSION['role']==1){
      Header("Location:index.php"); 
    }elseif($_SESSION['role']==2){
       Header("Location:supply_index.php"); 
   }
?>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优易购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script src="js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript">
function showTime(){
    nowtime=new Date();
    year=nowtime.getFullYear();
    month=nowtime.getMonth()+1;
    date=nowtime.getDate();
    document.getElementById("mytime").innerText=year+"年"+month+"月"+date+" "+nowtime.toLocaleTimeString();
}

setInterval("showTime()");

</script>
</head>
<body>
    <div class="top">
        <span>安装师傅 - 首页</span>
        <div class="tright"><span class="outlogin">退出登陆</span></div>
    </div>
    <div class="time" id="mytime"></div>
    
    
    
     <?php

    $result=mysql_query("select * from ci_contact where addstaffid=".$_SESSION['userid']." and isDelete=0"); 
    $i=0;
    $Total;//总库存
    $Surplus;//当前库存
    $num;//交易额
    $but;//是否显示补货按钮
    
    while($row=mysql_fetch_array($result))
        
    { 
    
    
    ?>
    
    
    <div class="list" id="list<?=$row['id']?>">
        <p>网点名称：<?=$row['name']?></p>
        <div class="supplydingwei">
                <img src="img/dingwei.png" alt="">
                <span>导航到此</span>
                <?php
                if($row['disable']==1){
                    $i++;
                ?> 
                 <div class="addno" id="add<?=$row['id']?>" onclick="buhuo(<?=$row['id']?>)">安装</div>
                <?php 
                }else{
                  ?>   
                  
                 <div class="addok" >安装完成</div>
                 
                <?php
                }
                ?>
                
                
            </div>
    </div>
    
    <?php   }?>
    
    
    <div style=" width:100%;height:100px; float:left;"></div>
    <div class="supplyfootbut"><img src="img/i.png" alt="">当前有<span class="shuzi"><?=$i?></span>网点仍未安装</div>
</body>
<script>
function buhuo(id){
var msg = "确定该网点的货架已安装？";
if (!confirm(msg)==true){
return false;
}
 $.post("ajaxwangdianok.php",{id:id},function(data) {
  if(data=="y"){
      var shuzi = $(".shuzi").html() - 1;
      $(".shuzi").html(shuzi);
      $("#add"+id).unbind( "click" );
      $("#add"+id).removeClass("addno");
      $("#add"+id).addClass("addok");
      $("#add"+id).html("安装完成");
      alert('安装成功');
  }						
 });
}
</script>
<script src="js/outlogin.js"></script>
</html>